package com.white.algebra.service.impl;

import com.white.algebra.service.CalculateService;
import com.white.algebra.service.ClassifyService;

import java.util.Date;

public class ClassifyServiceImpl implements ClassifyService {
    @Override
    public String classify(String textA, String textB, String selectOption) {
        CalculateService calculateService=new CalculateServiceImpl();
        String end = "null";
        switch (selectOption){
            case "1":
                end=calculateService.determinantCalculate(textA);
                break;
            case "2":
                end=calculateService.solveLinearEquations(textA,textB);
                break;
            case "3":
                end=calculateService.matrixAddition(textA,textB);
                break;
            case "4":
                end=calculateService.matrixMultiplication(textA,textB);
                break;
            case "5":
                end=calculateService.matrixTranspose(textA);
                break;
            case "6":
                end=calculateService.inverseMatrix(textA);
                break;
            case "7":
                end=calculateService.matrixRank(textA);
                break;
            case "8":
                end=calculateService.linearCorrelation(textA);
                break;
            case "9":
                end=calculateService.matrixEigenvalues(textA);
                break;
            case "10":
                end=calculateService.matrixSimilarity(textA,textB);
                break;
            default:end="error";
        }
        return end;
    }


    public Date test(String textA) throws InterruptedException {
        for(int i=0;i<10;i++){
            Thread.sleep(10000);
            System.out.println("ok: "+i);
        }
        return new Date();
    }
}
